#ifndef _FONTMANAGER_H_
#define _FONTMANAGER_H_

#include <windows.h>
#include <d3dx9.h>
#include <utillib/util/singleton.h>

#pragma warning ( disable : 4786 )
#include <deque>
#include <functional>
#include <interfacelib/window/text.h>

namespace interfacelib
{
	namespace Window
	{
		class FontManager
		{
		public:		
			struct FontStruct
			{
				char faceName[ LF_FACESIZE ];
				int size;
				int weight;
				LPD3DXFONT D3DXFont;
			};
		private:
			typedef std::deque < FontStruct * > dequeFont;
		protected:
			FontManager();
		public:
			virtual ~FontManager();

		public:
			SingletonInstance( FontManager );
			
			void initialize( LPDIRECT3DDEVICE9 D3DDevice, LPD3DXSPRITE sprite );
			void release();

			FontManager::FontStruct *getFont( const char *faceName , int size, int weight = FW_NORMAL );
			FontManager::FontStruct *getDeafultFont(){ return ( m_defaultFont ); };

			HRESULT drawText( LPCSTR string, int count, LPRECT rect, DWORD format, D3DCOLOR color , FontStruct *font );
			void getTextSize( SIZE *size , const char *string , int stringLength , FontStruct *font );

		private:
			LPDIRECT3DDEVICE9 m_D3DDevice;
			LPD3DXSPRITE m_sprite;
			FontStruct *m_defaultFont;
			dequeFont m_fontList;
//			Text m_text;
//			HDC m_dc;
		};
	}
}

#endif